ARD2  1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
freemaster_protocol.c File Reference

FreeMASTER protocol handler. More...

#include "freemaster.h"
#include "freemaster_private.h"
#include "freemaster_protocol.h"

Functions

FMSTR_BOOL FMSTR_Init (void)
 FreeMASTER driver initialization.
FMSTR_BOOL FMSTR_ProtocolDecoder (FMSTR_BPTR pMessageIO)
 Decodes the FreeMASTER protocol and calls appropriate handlers.
FMSTR_BPTR FMSTR_GetBoardInfo (FMSTR_BPTR pMessageIO)
 Handling GETINFO or GETINFO_BRIEF.
FMSTR_BPTR FMSTR_ReadMem (FMSTR_BPTR pMessageIO)
 Handling READMEM and READMEM_EX commands.
FMSTR_BPTR FMSTR_ReadVar (FMSTR_BPTR pMessageIO, FMSTR_SIZE8 nSize)
 Handling READVAR and READVAR_EX commands (for all sizes 1,2,4)
FMSTR_BPTR FMSTR_WriteMem (FMSTR_BPTR pMessageIO)
 Handling WRITEMEM and WRITEMEM_EX commands.
FMSTR_BPTR FMSTR_WriteVar (FMSTR_BPTR pMessageIO, FMSTR_SIZE8 nSize)
 Handling WRITEVAR command.
FMSTR_BPTR FMSTR_WriteMemMask (FMSTR_BPTR pMessageIO)
 Handling WRITEMEMMASK and WRITEMEMMASK_EX commands.
FMSTR_BPTR FMSTR_WriteVarMask (FMSTR_BPTR pMessageIO, FMSTR_SIZE8 nSize)
 Handling WRITEVARMASK command.
FMSTR_U16 FMSTR_StrLen (FMSTR_ADDR nAddr)
 Private inline implementation of "strlen" used by TSA and Pipes.

Detailed Description

FreeMASTER protocol handler.

Version:
1.0.29.0
Date:
Aug-25-2011

This file contains the FreeMASTER protocol decoder and also the handlers of basic protocol commands (read/write memory etc).


Function Documentation

FMSTR_BPTR FMSTR_GetBoardInfo ( FMSTR_BPTR  pMessageIO)

Handling GETINFO or GETINFO_BRIEF.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BOOL FMSTR_ProtocolDecoder ( FMSTR_BPTR  pMessageIO)

Decodes the FreeMASTER protocol and calls appropriate handlers.

Parameters:
pMessageIO- message in/out buffer
Returns:
TRUE if frame was valid and any output was generated to IO buffer

This Function decodes given message and invokes proper command handler which fills in the response. The response transmission is initiated in this call as well.

FMSTR_BPTR FMSTR_ReadMem ( FMSTR_BPTR  pMessageIO)

Handling READMEM and READMEM_EX commands.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_ReadVar ( FMSTR_BPTR  pMessageIO,
FMSTR_SIZE8  nSize 
)

Handling READVAR and READVAR_EX commands (for all sizes 1,2,4)

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_WriteMem ( FMSTR_BPTR  pMessageIO)

Handling WRITEMEM and WRITEMEM_EX commands.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_WriteMemMask ( FMSTR_BPTR  pMessageIO)

Handling WRITEMEMMASK and WRITEMEMMASK_EX commands.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_WriteVar ( FMSTR_BPTR  pMessageIO,
FMSTR_SIZE8  nSize 
)

Handling WRITEVAR command.

Parameters:
pMessageIO- original command (in) and response buffer (out)
nSize- variable size
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_WriteVarMask ( FMSTR_BPTR  pMessageIO,
FMSTR_SIZE8  nSize 
)

Handling WRITEVARMASK command.

Parameters:
pMessageIO- original command (in) and response buffer (out)
nSize- variable size
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)